package lgs.hm.aop;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

//@Aspect  //拦截方法，即拦截器
@Component
public class ShuaiGe {
	
	@Pointcut("execution(* lgs.hm.aop.Girl.*(..))")
	public void haha() {}
	
	@Before("lgs.hm.aop.ShuaiGe.haha()")  //前置通知
	public void before() {
		System.out.println("要不我来付吧");
	}
	
	@After("haha()")   //后置通知
	public void after() {
		System.out.println("下次我来付");  
		System.out.println("===============");
	}
	
	@AfterReturning("haha()")  //返回值通知
	public void retn() {
		System.out.println("有返回值");
	}
	
	@AfterThrowing("haha()")  //异常通知
	public void except() {
		System.out.println("出错通知");
	}
	
	
}
